import 'package:get/get.dart';
import 'package:xin_nuo_pda/base/BaseController.dart';
import 'package:xin_nuo_pda/bean/lot_entity.dart';
import 'package:xin_nuo_pda/http/api/lot_api.dart';
import 'package:xin_nuo_pda/product/end_work/EndWorkNextOneDefectPage.dart';

import '../../routes/Routes.dart';
import 'EndWorkNextOneDefectPage.dart';
import 'EndWorkNextOneDefectPage.dart';

class EndWorkController extends BaseController {
  String lotEntityID = "lotEntityID";
  LotEntity? lotEntity;
  String eqpID = "";

  @override
  void onInit() {
    super.onInit();
  }

  next() {
    // lotEntity?.eQUIPMENTID = eqpID;
    switch(lotEntity?.TRACK_OUT_WIZARD){
      case "XNDieBondingTrackOut":
        Get.toNamed( Routes.EndWorkNextOne, arguments: lotEntity);
        break;
      case "XNAssemblyTrackOut":
        Get.toNamed( Routes.EndWorkNextOneNormal, arguments: lotEntity);
        break;
      case "XNAssemblyTrackOutDefect":
        Get.toNamed( Routes.EndWorkNextOneDefect, arguments: lotEntity);
        break;
    }
    // Get.toNamed(
    //     (lotEntity?.TRACK_OUT_WIZARD == 'XNDieBondingTrackOut'
    //         ? Routes.EndWorkNextOne
    //         : Routes.EndWorkNextOneNormal),
    //     arguments: lotEntity);
  }

  getLotInfo(String lotID) async {
    Map<String, dynamic> params = {'LOTID': lotID};
    var result = await LotApi.lotInfo(canelToken, params: params);
    if (result.ok) {
      lotEntity = result.data;
      update([lotEntityID]);
    }
  }
}
